package org.budo.spring.velocity.view;

import java.util.Properties;

import org.budo.spring.velocity.resource.manager.BudoResourceManager;
import org.springframework.web.servlet.view.velocity.VelocityConfigurer;

/**
 * @author limingwei
 */
@SuppressWarnings("deprecation")
public class BudoVelocityConfigurer extends VelocityConfigurer {
    private String resourceLoaderPath;

    public BudoVelocityConfigurer() {
        Properties properties = new Properties();
        properties.setProperty("resource.manager.class", BudoResourceManager.class.getName());

        properties.setProperty("input.encoding", "UTF-8");
        properties.setProperty("output.encoding", "UTF-8");
        properties.setProperty("contentType", "text/html;charset=UTF-8");
        this.setVelocityProperties(properties);
    }

    @Override
    public void setResourceLoaderPath(String resourceLoaderPath) {
        this.resourceLoaderPath = resourceLoaderPath;
        super.setResourceLoaderPath(resourceLoaderPath);
    }

    public String getResourceLoaderPath() {
        return resourceLoaderPath;
    }
}
